package cz.uvn.orthopedy.client.entity;

import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

import com.google.gwt.user.client.rpc.IsSerializable;

@PersistenceCapable
public class Doctor extends Person implements IsSerializable {

	@Persistent
	private String title;

	@Persistent
	private boolean isAdmin;

	public Doctor() {
	}

	public Doctor(Long id, String name, String surname, String title, boolean isAdmin) {
		this.id = id;
		this.name = name;
		this.surname = surname;
		this.title = title;
		this.isAdmin = isAdmin;
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	public boolean isAdmin() {
		return isAdmin;
	}

	public void setAdmin(boolean isAdmin) {
		this.isAdmin = isAdmin;
	}

	@Override
	public String toString() {
		if (title == null || title.length() == 0) {
			return "Doctor " + title + ' ' + name + ' ' + surname;
		}
		return title + ' ' + name + ' ' + surname;
	}
}
